
#include "member_BClass.h"

using namespace BWE;

bool BWE::AnalyseDeclare(const BString& declare, BString& type, BString& name)
{
	name = declare;
	name.trimmed();
	name.simplify();
	int pos = name.find('(');
	int end = name.find(')');
	BString paramsText;
	name.substr(paramsText, pos + 1, end);
	int type_end = 0;
	while (--pos >= 0 && pos < name.size())
	{
		char c = name[pos];
		if (isspace(c))
		{
			type_end = pos;
			break;
		}
	}
	name.substr(type, 0, type_end);
	name.remove(0, type_end);
	name.trimmed();
	return true;
}
bool BWE::AnalyseDeclare(const BString& declare, BString& type, BString& name, BStringList& params)
{
	name = declare;
	name.trimmed();
	name.simplify();
	int pos = name.find('(');
	int end = name.find(')');
	BString paramsText;
	name.substr(paramsText, pos + 1, end);
	int type_end = 0;
	while (--pos >= 0 && pos < name.size())
	{
		char c = name[pos];
		if (isspace(c))
		{
			type_end = pos;
			break;
		}
	}
	name.substr(type, 0, type_end);
	name.remove(0, type_end);
	name.trimmed();
	paramsText.split(params, ',');
	return true;
}

member_BClass::member_BClass(BClass* cls)
{
	boss = cls;
	meta = false;
}
member_BClass::~member_BClass()
{

}

bool member_BClass::checkInherit(const BString& type)
{
	for (int i = 0; i < inherits.size(); i++)
	{
		if (inherits[i]->type == type)
			return true;
	}
	return false;
}
